<%--
  Created by IntelliJ IDEA.
  User: qjqe@outlook.com
  Date: 2020/4/7
  Time: 14:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script>
    $(function () {
        var v=document.getElementById("newPassword").value;
        var v1=document.getElementById("againPassword").value;
        $("#chagepassword-button").click(function () {

            if (v1==v){
                $.post("/sss/admin/chagepassword",{
                        lastpassword:document.getElementById("lastPassword").value,
                        newpassword:document.getElementById("newPassword").value
                    },
                    function(data){
                        if (data.success){
                            alert("成功")
                        }else {
                            alert("失败")
                        }
                        $("#lastPassword").val("");
                        $("#newPassword").val("");
                        $("#againPassword").val("");
                    },"json");
            }
            else {
                alert("密码错误，请重新输入");
                $("#lastPassword").val("");
                $("#newPassword").val("");
                $("#againPassword").val("");
            }
        });

    })
</script>
<h2 class="sub-header">修改密码</h2>
<div class="controls" style="width: 500px">
    <div class="form-group">
        <label for="lastPassword">原密码</label>
        <input type="password" class="form-control" id="lastPassword" placeholder="原密码">
    </div>
    <div class="form-group">
        <label for="newPassword">新密码</label>
        <input type="password" class="form-control" id="newPassword" placeholder="新密码">
    </div>
    <div class="form-group">
        <label for="againPassword">再输一遍</label>
        <input type="password" class="form-control" id="againPassword" placeholder="再输一遍">
    </div>
    <button type="button"  id="chagepassword-button" class="btn btn-default">提交</button>
</div>
